<template>
  <div id="index" ref="appRef">
    <div class="bg">
      <dv-loading v-show="loading">Loading...</dv-loading>
      <div class="host-body">
        <div>
          <!-- 顶部title部分 -->
          <el-row>
            <el-col :span="6">
              <!--              <div class="title_device_state">-->
              <!--                <span>设备状态：</span>-->
              <!--                <span class="device_state">{{state == true?'运行中':'已停止'}}</span>-->
              <!--              </div>-->
              <dv-decoration-8
                class="title_right"
                :color="['#008CFF', '#00ADDD']"
              />
            </el-col>
            <el-col :span="12">
              <div class="title_text">初烤烟近红外化学成分分析</div>
              <div class="container">
                <div class="left-gradient"></div>
                <div class="right-gradient"></div>
              </div>
              <div class="container">
                <div class="left-gradient1"></div>
                <div class="right-gradient2"></div>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="title_time">
                <span style="padding-right: 12px">{{ dateYear }}</span>
                <span style="padding-right: 12px">{{ dateWeek }}</span>
                <span style="font-size: 28px">{{ dateDay }}</span>
                <!--                  {{ dateYear + dateWeek + dateDay }}-->
              </div>
              <dv-decoration-8
                :reverse="true"
                class="title_left"
                :color="['#008CFF', '#00ADDD']"
              />
            </el-col>
          </el-row>
          <!-- 主体部分 -->
          <el-row>
            <!-- 第一列 -->
            <el-col :span="7">
              <div class="left_box1 dialog_y">
                <div class="box_y">
                  <visualData1></visualData1>
                </div>
              </div>
              <div class="left_box2 dialog_y">
                <div class="box_y">
                  <visualData6></visualData6>
                </div>
              </div>
              <div class="left_box3 dialog_y">
                <div class="box_y">
                  <visualData2></visualData2>
                </div>
              </div>
              <div class="left_box4 dialog_y">
                <div class="box_y">
                  <visualData8></visualData8>
                </div>
              </div>
            </el-col>
            <!-- 第二列 -->
            <el-col :span="10">
              <div id="video-map" style="padding: 10px">
                <dv-border-box-10>
                  <visualData4></visualData4>
                </dv-border-box-10>
              </div>
              <div class="line_center">
                <dv-border-box-13>
                  <visualData5></visualData5>
                </dv-border-box-13>
              </div>
            </el-col>
            <!-- 第三列 -->
            <el-col :span="7">
              <div class="right_box1 dialog_y">
                <div class="box_y">
                  <visualData3></visualData3>
                </div>
              </div>
              <div class="right_box2 dialog_y">
                <div class="box_y">
                  <visualData7></visualData7>
                 </div>
              </div>
              <!-- 部分 -->
              <div class="right_box3 dialog_y">
                <div class="box_y">
                  <visualData9></visualData9>
                 </div>
              </div>
<!--              <div class="right_box4 dialog_y">-->
<!--                <div class="box_y">-->
<!--                  <visualData8></visualData8>-->
<!--                 </div>-->
<!--              </div>-->
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import drawMixin from "../../utils/largeScreen/drawMixin"; //自适应缩放
import {formatTime} from "@/utils/largeScreen"; //日期格式转换
import visualData1 from '@/components/LargeScreen/visualData1'
import visualData2 from '@/components/LargeScreen/visualData2'
import visualData3 from '@/components/LargeScreen/visualData3'
import visualData4 from '@/components/LargeScreen/visualData4'
import visualData5 from '@/components/LargeScreen/visualData5'
import visualData6 from '@/components/LargeScreen/visualData6'
import visualData7 from '@/components/LargeScreen/visualData7'
import visualData8 from '@/components/LargeScreen/visualData8'
import visualData9 from '@/components/LargeScreen/visualData9'
import visualData10 from '@/components/LargeScreen/visualData10'

export default {
  name: 'LargeScreen',
  components: {
    visualData1,
    visualData2,
    visualData3,
    visualData4,
    visualData5,
    visualData6,
    visualData7,
    visualData8,
    visualData9,
    visualData10
  },
  mixins: [drawMixin],
  data() {
    return {
      //定时器
      timing: null,
      //loading图
      loading: true,
      //时分秒
      dateDay: null,
      //年月日
      dateYear: null,
      //周几
      dateWeek: null,
      //周几
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
      //设备状态
      state: true,
    };
  },
  created() {
    document.title="烟叶土壤养分管理系统"
  },
  mounted() {

    //获取实时时间
    this.timeFn();
    //加载loading图
    this.cancelLoading();
  },
  beforeDestroy() {
    //离开时删除计时器
    clearInterval(this.timing);
  },
  methods: {
    //右上角当前日期时间显示：每一秒更新一次最新时间
    timeFn() {
      this.timing = setInterval(() => {
        //获取当前时分秒
        this.dateDay = formatTime(new Date(), "HH: mm: ss");
        //获取当前年月日
        this.dateYear = formatTime(new Date(), "yyyy-MM-dd");
        //获取当前周几
        this.dateWeek = this.weekday[new Date().getDay()];
      }, 1000);
    },
    //loading图
    cancelLoading() {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    },
  },
  // methods: {
  //   // 固定显示：2025-06-02 周一 12:17:17
  //   timeFn() {
  //     // 如有旧计时器，先清掉
  //     if (this.timing) clearInterval(this.timing);
  //
  //     const fixed = new Date('2025-06-16T12:17:17');
  //
  //     this.dateDay  = formatTime(fixed, 'HH: mm: ss');   // 12: 17: 17
  //     this.dateYear = formatTime(fixed, 'yyyy-MM-dd');   // 2025-06-02
  //     this.dateWeek = this.weekday[fixed.getDay()];      // 周一
  //
  //     // 不再启动定时器
  //     this.timing = null;
  //   },
  //   // loading图
  //   cancelLoading() {
  //     setTimeout(() => {
  //       this.loading = false;
  //     }, 500);
  //   },
  // },
};
</script>
<style lang="scss">
//全局样式部分！！！！
* {
  margin: 0;
  padding: 0;
  list-style-type: none;
  outline: none;
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2em;
  background-color: #f1f1f1;
  margin: 0;
  padding: 0;
}

a {
  color: #343440;
  text-decoration: none;
}

//--------------------------------------------

//页面样式部分！！！！
#index {
  color: #d3d6dd;
  width: 1920px;
  height: 1080px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: left top;
  overflow: hidden;

  .bg {
    //整体页面背景
    width: 100%;
    height: 100%;
    padding: 16px 16px 0 16px;
    background-image: url("../../assets/pageBg.png"); //背景图
    background-size: cover; //背景尺寸
    background-position: center center; //背景位置
  }

  //顶部右边装饰效果
  .title_left {
    width: 100%;
    height: 50px;
    margin-top: -14px;
  }

  //顶部左边装饰效果
  .title_right {
    width: 100%;
    height: 50px;
    margin-top: 18px;
  }

  //顶部中间装饰效果
  .title_center {
    width: 100%;
    height: 50px;
  }

  //顶部中间文字数据可视化系统
  .title_text {
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    background: linear-gradient(90deg, #00c6ff, #f1f4f6);
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: 3px;
    line-height: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  }

  //
  //.title_device_state{
  //  text-align: left;
  //  padding-left: 60px;
  //  margin-top: 12px;
  //  font-size: 20px;
  //  letter-spacing: 2px;
  //  color: #ffffff; /* 设定文字颜色为白色 */
  //  text-shadow:
  //    0 0 10px #d2b4ce, /* 模拟第一层发光 */
  //    0 0 8px #008cff, /* 模拟第二层发光 */
  //    0 0 2px #fff; /* 模拟第三层发光 */
  //  .device_state{
  //    font-size: 26px;
  //    text-shadow:
  //      0 0 10px #6e7559, /* 模拟第一层发光 */
  //      0 0 8px #83d52c, /* 模拟第二层发光 */
  //      0 0 2px #fff; /* 模拟第三层发光 */
  //  }
  //}
  //时间日期
  .title_time {
    text-align: right;
    padding-right: 60px;
    margin-top: 11px;
    font-size: 20px;
    color: #ffffff; /* 设定文字颜色为白色 */
    text-shadow: 0 0 10px #d2b4ce, /* 模拟第一层发光 */
    0 0 8px #008cff, /* 模拟第二层发光 */
    0 0 2px #fff; /* 模拟第三层发光 */
    //0 0 5px #ff00de; /* 最外层发光颜色可以更明显一些 */
  }


  //视频
  #video-map {
    height: 640px;
    width: 100%;
  }

  //中间折线图
  .line_center {
    width: 100%;
    height: 350px;
  }

  //左1模块
  .left_box1 {
    height: 247px;
    width: 100%;
  }

  .dialog_y{
    position: relative;
    border: 1px solid rgba(30, 120, 236, 0.25);
    .box_y::after {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 4px;
      height: 4px;
      border-right: 2px solid #44aaff;
      border-bottom: 2px solid #44aaff;
      content: "";
    }

    .box_y::before {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 4px;
      height: 4px;
      border-left: 2px solid #44aaff;
      border-bottom: 2px solid #44aaff;
      content: "";
    }

  }

  .dialog_y::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    border-left: 2px solid #44aaff;
    border-top: 2px solid #44aaff;
    content: "";
  }

  .dialog_y::after {
    position: absolute;
    content: "";
    top: 0;
    right: 0;
    width: 4px;
    height: 4px;
    border-right: 2px solid #44aaff;
    border-top: 2px solid #44aaff;
  }


  //左2模块
  .left_box2 {
    height: 247px;
    width: 100%;
    //margin-bottom: 10px;
  }

  //左3模块
  .left_box3 {
    height: 247px;
    width: 100%;
  }

  //左4模块
  .left_box4 {
    height: 247px;
    width: 100%;
  }

  //右1模块
  .right_box1 {
    height: 247px;
    width: 100%;
    //margin-bottom: 10px;
  }

  //右2模块
  .right_box2 {
    height: 247px;
    width: 100%;
    //margin-bottom: 10px;
  }

  //右3模块
  .right_box3 {
    height: 496px;
    width: 100%;
  }

  //右4模块
  .right_box4 {
    height: 247px;
    width: 100%;
  }
}

.container {
  display: flex;
  justify-content: space-between;

  .left-gradient {
    width: 50%;
    height: 3px;
    background: linear-gradient(to left, rgb(0, 140, 255), transparent);
    margin: 5px 0;
  }

  .right-gradient {
    width: 50%;
    height: 3px;
    background: linear-gradient(to right, rgb(0, 140, 255), transparent);
    margin: 5px 0;
  }

  .left-gradient1 {
    width: 35%;
    height: 3px;
    background: linear-gradient(to left, rgb(0, 140, 255), transparent);
    margin: 5px 0;
  }

  .right-gradient2 {
    width: 35%;
    height: 3px;
    background: linear-gradient(to right, rgb(0, 140, 255), transparent);
    margin: 5px 0;
  }
}
</style>


